//
//  GoodsDetailBottomView.m
//  YunGou
//
//  Created by macbook on 16/5/27.
//  Copyright © 2016年 macbook. All rights reserved.
//

#import "GoodsDetailBottomView.h"
@interface GoodsDetailBottomView ()

@property (weak, nonatomic) IBOutlet UIButton *goodsCartImage;

@end

@implementation GoodsDetailBottomView
- (void)awakeFromNib{
    _goodsCartNum.layer.cornerRadius = _goodsCartNum.bounds.size.width/2;
    _goodsCartNum.clipsToBounds = YES;
}

- (IBAction)btnClicked:(id)sender {
    UIButton *btn = (UIButton *)sender;
    if (btn.tag == 2) {
        CABasicAnimation *shakeAnimation = [CABasicAnimation animationWithKeyPath:@"transform.translation.y"];
        shakeAnimation.duration = 0.25f;
        shakeAnimation.fromValue = [NSNumber numberWithFloat:-5];
        shakeAnimation.toValue = [NSNumber numberWithFloat:5];
        shakeAnimation.autoreverses = YES;
        [_goodsCartImage.layer addAnimation:shakeAnimation forKey:nil];
    }
    
    if (self.bottomBlock) {
        self.bottomBlock(btn.tag);
    }
}
@end
